<?php
session_start();
require_once './core/sql.php';
$sql = new SqlS();

?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=0,maximum-scale=1.0"/>
    <title><?= $_GET['uid'] ?>的报名表</title>
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/index.css">
    <script>
        function adapte() {//适配
            var designWidth = 1080, rem2px = 100;
            document.documentElement.style.fontSize = window.innerWidth / designWidth * rem2px + "px";
        }
        adapte();
    </script>
</head>
<style>
    input[disabled]{
        background-color: #fff;
        color:#000;
        opacity:1
    }
</style>
<body>
<ul class="form bulid-form fs36">
    <ul class="lists flex">
        <?php
        // 所有问题
        if (isset($_GET['cid']) && isset($_GET['pid']) && isset($_GET['uid'])) {
        $x = 0;
        list($num, $array) = $sql->CPUidForm($_GET['cid'], $_GET['pid'], $_GET['uid']);
        for ($i = 0; $i < $num; $i++) {
            $answer_array = explode(';', $array[$i][1]);
            array_pop($answer_array);
            switch ($array[$i][2]) {
                case '2':
                    // 单选
                    ?>
                    <li>
                    <span>
                        <?= $array[$i][0] ?>
                    </span>
                        <div class="radio">
                        <span class="active">
                            <?= $answer_array[0] ?>
                        </span>
                        </div>
                    </li>
                    <?php
                    break;
                case '3':
                    // 多选
                    ?>
                    <li class="checkbox">
                    <span>
                        <?= $array[$i][0] ?>
                    </span>
                        <ul class="flex fs36">
                            <?php
                            $nn = count($answer_array);
                            for ($j = 0; $j < $nn; $j++) {
                                ?>
                                <li class="active">
                                    <?= $answer_array[$j] ?>
                                </li>
                                <?php
                            }
                            ?>
                        </ul>
                    </li>
                    <?php
                    break;
                case '1':
                    // 填空
                    ?>
                    <li>
                            <span>
                                <?= $array[$i][0] ?>
                            </span>
                        <input type="text" disabled="disabled" value="<?= $answer_array[0] ?>">
                    </li>
                    <?php
                    break;
                default :
            }
        }

        ?>
        <!--			<li class="correct">-->
        <!--				<span>家长姓名</span><input type="text">-->
        <!--			</li>-->
        <!--			<li class="error">-->
        <!--				<span>家长手机</span><input type="text">-->
        <!--			</li>-->
        <!--			<li>-->
        <!--				<span>学生姓名</span><input type="text">-->
        <!--			</li>-->
        <!--			<li><span>出身日期</span><input type="text"></li>-->
        <!--			<li><span>平时爱好</span><input type="text"></li>-->
        <!--			<li><span>家庭住址</span><input type="text"></li>-->
        <!--			<li>-->
        <!--				<span>是否学过</span>-->
        <!--				<div class="radio">-->
        <!--					<span class="active">是</span>-->
        <!--					<span>否</span>-->
        <!--				</div>-->
        <!--			</li>-->
        <!--			<li class="checkbox">-->
        <!--				<span>课程选择</span><span>(可多选)</span>-->
        <!--				<ul class="flex fs36">-->
        <!--					<li class="active">舞蹈课</li>-->
        <!--					<li>画画课</li>-->
        <!--					<li>音乐课</li>-->
        <!--					<li>英语课</li>-->
        <!--					<li>舞蹈课</li>					-->
        <!--					<li>舞蹈课</li>-->
        <!--					<li>舞蹈课</li>-->
        <!--					<li>舞蹈课</li>-->
        <!--				</ul>-->
        <!--			</li>-->
    </ul>
</ul>
<div class="btn">

</div>
<?php
} else {
    echo '表格不存在！';
}
?>
</div>
<script src='./script/jquery.js'></script>
<script src='./script/index.js'></script>
<script src="./script/app.js"></script>
<script></script>
</body>
</html>